@extends('layouts.app')
@section('content')
    <div class="container">
        <div class="row">
            <div class="col-md-10 col-md-offset-1">
                <div class="panel panel-default">
                    <div class="panel-heading">消息中心</div>
                    <div class="panel-body">
                        @if (count($errors) > 0)
                            <div class="alert alert-danger">
                                {!! implode('<br>', $errors->all()) !!}
                            </div>
                        @endif
                        @foreach($messages as $message)
                            <ul>
                                <li class="llink">
                                    {{ $message->from }}
                                    在回复
                                    [<a href="{{ url("/article/".$message->article_id).'#new' }}">{{ $message->article_title }}</a>]
                                    时提到了你
                                    <?php
                                    $utils = new Utils();
                                    echo $utils->timediff(time(), strtotime($message['created_at']));
                                    ?>前
                                    <div style="float:right">
                                        @if ($message->isread)
                                            <font color="gray">{{"已读"}}</font>
                                        @else
                                            <font color="green">{{"未读"}}</font>
                                        @endif
                                    </div>
                                </li>
                            </ul>
                        @endforeach
                    </div>
                </div>
            </div>

        </div>
    </div>
@endsection
